import request from "@/utils/service.js";

// 查看业主的全部信息
export let yzxx = () => {
    return request({
        url: "/owner/getOwnerList",
        method: "GET"
    })
}

// 添加业主
export let addyz = (carNum, ownName, ownPhone, parkId) => {
    return request({
        url: "/owner/addOwner",
        method: "POST",
        data: {
            carNum,
            houseId: 5,
            ownName,
            ownPhone,
            parkId,
        }
    })
}

// 查找单个业主信息
export let chazhao = (ownerName) => {
    return request({
        url: "/owner/getOwnerList",
        method: "GET",
        params: {
            ownerName
        }
    })
}

// 修改业主信息
export let update = (id, carNum, ownName, ownPhone, parkId) => {
    return request({
        url: "/owner/updateOwner",
        method: "PUT",
        data: {
            id,
            houseId: 5,
            carNum,
            ownName,
            ownPhone,
            parkId
        }
    })
}

// 删除业主信息
export let deleteyz = (id) => {
    return request({
        url: "/owner/deleteOwner/" + id,
        method: "DELETE",
    })
}

//修改房屋id
export let gethouse = () => {
    return request({
        url: "/house/getHouseByFalseStatus",
        method: "GET",
    })
}

//宠物房屋id
export let getPetHouse = () => {
    return request({
        url: "/house/getHouseByTrueStatus",
        method: "GET"
    })
}

// 查看所有宠物信息
export let lookpet = () => {
    return request({
        url: "/pet/getPetList",
        method: "GET"
    })
}


export let uploadImg = (img) => {
    const formData = new FormData()
    formData.append('img', img)
    return request({
        url: '/upload',
        headers: { 'Content-Type': 'multipart/form-data' },
        method: 'POST',
        data: formData
    })
}

// 查询某个宠物信息
export let findpet = (petName) => {
    return request({
        url: "/pet/getPetList",
        method: "GET",
        params: {
            petName
        }

    })
}


// 删除宠物信息
export let deletepet = (id) => {
    return request({
        url: "/pet/deletePet/" + id,
        method: "DELETE"
    })
}



// 添加宠物信息
export let addpet = (category, houseId, petAge, petImg, petName) => {
    return request({
        url: "/pet/addPet",
        method: "POST",
        data: {
            category,
            houseId,
            petAge,
            petImg,
            petName
        }
    })
}

// 图片信息
export let petimg = () => {
    return request({
        url: "/upload",
        method: "POST"
    })
}


// 修改宠物信息
export let gaipet = (category,createTime,houseId,id,petAge,petImg,petName) => {
    return request({
        url: "/pet/updatePet",
        method: "PUT",
        data: {
            category,
            createTime,
            houseId,
            id,
            petAge,
            petImg,
            petName
        }
    })
}
